library COI0010;

uses
  Windows,
  Messages,
  SysUtils,
  Classes,
  Forms,
  UCOI0010 in 'UCOI0010.pas' {FCOI0010},
  UGlobal in '..\..\Global\UGlobal.pas',
  UDataModuleClient in '..\..\Global\UDataModuleClient.pas',
  UFrameCode in '..\..\Frame\UFrameCode.pas' {FrmCode: TFrame},
  UFrame_Period in '..\..\Frame\UFrame_Period.pas' {Frame_Period: TFrame},
  UFrameImgCombo in '..\..\Frame\UFrameImgCombo.pas' {FrmImgCombo: TFrame},
  UFrame_MonthSeqNo in '..\..\Frame\UFrame_MonthSeqNo.pas' {Frame_MonthSeqNo: TFrame},
  UFrameChkCombo in '..\..\Frame\UFrameChkCombo.pas' {FrmChkCombo: TFrame},
  UFrameChkComboItem in '..\..\Frame\UFrameChkComboItem.pas' {FrmChkComboItem: TFrame},
  UCOI0010P1 in 'UCOI0010P1.pas' {FCOI0010P1},
  UCOI0010P2 in 'UCOI0010P2.pas' {FCOI0010P2},
  UFrame_Date in '..\..\Frame\UFrame_Date.pas' {Frame_Date: TFrame},
  UCOI0010P5 in 'UCOI0010P5.pas' {FCOI0010P5},
  UCOI0010P4 in 'UCOI0010P4.pas' {FCOI0010P4},
  UCOI0010P3 in 'UCOI0010P3.pas' {FCOI0010P3};

var
  DllApplication: TApplication;

{$R *.res}

function CreateChild(App: TApplication; AGlobal: IGlobal): TForm; stdcall;
begin
  if not Assigned(DllApplication) then
  begin
    DllApplication:= Application;
    Application   := App;
  end;

  FCOI0010       := TFCOI0010.Create(Application.MainForm);
  FCOI0010.Global := AGlobal;
  Result          := FCOI0010;
end;

function ExecuteParam(ParamInt: Integer; ParamStr: string;
  AutoSearchYN: Boolean): Variant; stdcall;
begin
  Result := 0;
  if (ParamInt = 0) and (ParamStr = 'Init') then
  begin
    FCOI0010.Init;
    if AutoSearchYN then
      FCOI0010.BtnOpen.Click;
  end;
end;

procedure DLLUnloadProc(Reason: Integer); register;
begin
  if Reason = DLL_PROCESS_DETACH then
    if Assigned(DllApplication) then
      Application := DllApplication;
end;

exports
  CreateChild, ExecuteParam;

begin
  DllApplication:= nil;
  DLLProc       := @DLLUnloadProc;

end.
